/*
 * Copyright (C) 2009 Rob Cash
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Schedule.java
 */

package org.robcash.apps.messagepopup.vo;

import java.util.Arrays;
import java.util.Date; 
import java.util.HashSet;
import java.util.Set;

public interface Schedule {

    public static final int SUNDAY = 0;
    public static final int MONDAY = 1;
    public static final int TUESDAY = 2;
    public static final int WEDNESDAY = 3;
    public static final int THURSDAY = 4;
    public static final int FRIDAY = 5;
    public static final int SATURDAY = 6;

    public static final Set<Integer> EVERY_DAY = new HashSet<Integer>(
            Arrays.asList(new Integer[] { SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
            THURSDAY, FRIDAY, SATURDAY }));

    public static final Set<Integer> WEEKDAYS = new HashSet<Integer>(
            Arrays.asList(new Integer[] { MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
            FRIDAY }));

    /**
     * Get the name of the schedule
     * @return Name of schedule
     */
    public String getName();

    /**
     * Set the name
     * @param name Name of schedule
     */
    public void setName(String name);

    /**
     * Get a description of the schedule
     * @return Textual representation of the schedule
     */
    public String getDescription();
    
    /**
     * Get the days on which the schedule is active
     * @return Days
     */
    public Set<Integer> getDays();

    /**
     * Set the days on which the schedule is active
     * @param days
     */
    public void setDays(Set<Integer> days);

    /**
     * Get the start time, irrespective of day, when messages could start
     * @return Time of day
     */
    public Date getStartTime();

    /**
     * Set the start time, irrespective of day, when messages could start
     * @param startTime Time of day
     */
    public void setStartTime(Date startTime);

    /**
     * Get the end time, irrespective of day, after which messages will stop
     * @return Time of day
     */
    public Date getEndTime();

    /**
     * Set the end time, irrespective of day, after which messages will stop
     * @param endTime Time of day
     */
    public void setEndTime(Date endTime);

    /**
     * Get the frequency
     * @return Number of times during the period that a message should appear
     */
    public int getFrequency();

    /**
     * Set the Number of times during the period that a message should appear
     * @param frequency Frequency of messages relative to period
     */
    public void setFrequency(int frequency);

    /**
     * Get the period, in minutes
     * @return Period, in minutes
     */
    public int getPeriod();

    /**
     * Set the period, in minutes
     * @param minutes Period, in minutes
     */
    public void setPeriod(int minutes);

    /**
     * Indicates if the schedule has regular intervals between messages
     * @return <tt>true</tt> if the time between messages is always the same
     */
    public boolean isPeriodic();

}

